int peer_not_interested_received(struct peer*,ssize_t);
int peer_piece(struct peer*);
int peer_piece_received(struct peer*,ssize_t);
+int peer_queue_process(struct peer*);
int peer_reject(struct peer*);
int peer_reject_received(struct peer*,ssize_t);
int peer_request(struct peer*);
if(info->out!=NULL) { goto remaining; }
if(!info->handshake) { goto handshake; }
-
+
if((i = net_expected(info,&type))<0) { goto close; }
switch(type) {
goto close;
}
+ if(NULL==info->out) { goto send; }
+
goto queue;
-remaining:
- if(send_remaining(info)<0) { goto close; }
- goto queue;
+close:
+ close(info->sock);
+ peer_free(info);
+ return;
handshake:
if(peer_handshake(info)<0) { goto close; }
goto queue;
queue:
if(net_queue(epoll_fd,info)<0) { goto close; }
return;
-close:
- close(info->sock);
- peer_free(info);
- return;
+remaining:
+ if(send_remaining(info)<0) { goto close; }
+ goto queue;
+send:
+ if(peer_queue_process(info)<0) { goto close; }
+ goto queue;
}
static int send_remaining(struct peer *info) {