src/developer/debug/zxdb/client/curl.cc
// Callback given to CURL which it uses to inform us it would like to do IO on a socket and that we
// should add it to our polling in the event loop.
Callback given to CURL which it uses to inform us it would like to do IO on a socket and that we
should add it to our polling in the event loop.
Callback given to CURL which it uses to inform us it would like to do IO on a socket and that we should add it to our polling in the event loop .
int SocketCallback(CURL* easy, curl_socket_t s, int what, void*, void*) {
  if (what == CURL_POLL_REMOVE || what == CURL_POLL_NONE) {
    CurlFDWatcher::watches.erase(s);
  } else {
    debug_ipc::MessageLoop::WatchMode mode;
    switch (what) {
      case CURL_POLL_IN:
        mode = debug_ipc::MessageLoop::WatchMode::kRead;
        break;
      case CURL_POLL_OUT:
        mode = debug_ipc::MessageLoop::WatchMode::kWrite;
        break;
      case CURL_POLL_INOUT:
        mode = debug_ipc::MessageLoop::WatchMode::kReadWrite;
        break;
      default:
        FX_NOTREACHED();
        return -1;
    };
    CurlFDWatcher::watches[s] =
        debug_ipc::MessageLoop::Current()->WatchFD(mode, s, &CurlFDWatcher::instance);
  }
  return 0;
}
int SocketCallback ( CURL * easy , curl_socket_t s , int what , void * , void * ) { if ( what == CURL_POLL_REMOVE || what == CURL_POLL_NONE ) { CurlFDWatcher :: watches . erase ( s ) ; } else { debug_ipc :: MessageLoop :: WatchMode mode ; switch ( what ) { case CURL_POLL_IN : mode = debug_ipc :: MessageLoop :: WatchMode :: kRead ; break ; case CURL_POLL_OUT : mode = debug_ipc :: MessageLoop :: WatchMode :: kWrite ; break ; case CURL_POLL_INOUT : mode = debug_ipc :: MessageLoop :: WatchMode :: kReadWrite ; break ; default : FX_NOTREACHED ( ) ; return -1 ; } ; CurlFDWatcher :: watches [ s ] = debug_ipc :: MessageLoop :: Current ( ) -> WatchFD ( mode , s , & CurlFDWatcher :: instance ) ; } return 0 ; }
Callback given to CURL which it uses to inform us it would like to do IO on a socket and that we
should add it to our polling in the event loop.
Callback given to CURL which it uses to inform us it would like to do IO on a socket and that we should add it to our polling in the event loop .