| | |
| | | /* Wait for listening/connected descriptor(s) to become ready */ |
| | | pool.ready_set = pool.read_set; |
| | | pool.nready = select(pool.maxfd + 1, &pool.ready_set, NULL, NULL, NULL); |
| | | // LoggerFactory::getLogger()->debug("select return \n"); |
| | | /* If listening descriptor ready, add new client to pool */ |
| | | if (FD_ISSET(listenfd, &pool.ready_set)) |
| | | { |
| | |
| | | |
| | | request_head = NetModSocket::decode_request_head(request_head_bs); |
| | | |
| | | // printf("server received request from host = %s:%d, key = %d, timeout=%d,\n", |
| | | // request_head.host, request_head.port , request_head.key, request_head.timeout); |
| | | |
| | | if(request_head.content_length > max_buf) { |
| | | |
| | |
| | | if (rio_readn(connfd, topic_buf, request_head.topic_length) != request_head.topic_length ) { |
| | | return -1; |
| | | } |
| | | // LoggerFactory::getLogger()->debug("====server pub %s===\n", buf); |
| | | |
| | | memcpy(response_head.host, request_head.host, NI_MAXHOST); |
| | | response_head.port = request_head.port; |
| | | // response_head.key = request_head.key; |