//#define ASCS_RECV_BUFFER_TYPE std::vector<asio::mutable_buffer> //scatter-gather buffer, it's very useful under certain situations (for example, ring buffer).
//#define ASCS_SCATTERED_RECV_BUFFER //used by unpackers, not belongs to ascs
//note, these two macro are not requisite, i'm just showing how to use them.
//note, these two macro are not requisite, I'm just showing how to use them.
//all other definitions are in the makefile, because we have two cpp files, defining them in more than one place is riskful (
//all other definitions are in the makefile, because we have two cpp files, defining them in more than one place is risky (
// we may define them to different values between the two cpp files)
//configuration
...
...
@@ -44,6 +44,12 @@ int main(int argc, const char* argv[])
}
service_pumpsp;
#ifndef ASCS_DECREASE_THREAD_AT_RUNTIME
//if you want to decrease service thread at runtime, then you cannot use multiple io_context, if somebody indeed needs it, please let me know.
//with multiple io_context, the number of service thread must be bigger than or equal to the number of io_context, please note.
//with multiple io_context, please also define macro ASCS_AVOID_AUTO_STOP_SERVICE.
//#define ASCS_RECV_BUFFER_TYPE std::vector<asio::mutable_buffer> //scatter-gather buffer, it's very useful under certain situations (for example, ring buffer).
//#define ASCS_SCATTERED_RECV_BUFFER //used by unpackers, not belongs to ascs
//note, these two macro are not requisite, i'm just showing how to use them.
//note, these two macro are not requisite, I'm just showing how to use them.
//all other definitions are in the makefile, because we have two cpp files, defining them in more than one place is riskful (
//all other definitions are in the makefile, because we have two cpp files, defining them in more than one place is risky (
// we may define them to different values between the two cpp files)
virtualvoidafter_close(){}//a good case for using this is to reconnect the server, please refer to client_socket_base.
virtualvoidafter_close()=0;//a good case for using this is to reconnect the server (please refer to client_socket_base) and return io_context to service_pump.
#ifdef ASCS_SYNC_DISPATCH
//return positive value if handled some messages (include all messages), if some msg left behind, socket will re-dispatch them asynchronously