f->sock = tempsock;
ioctl(f->sock, FIONBIO, &one);
init_file_transfer(f);
+
+ flush_numeric(f->owner);
+ if (f->owner->free_me) {
+ destroy_conn(f->owner);
+ continue;
+ }
+
#if WANT_UPLOAD
if (f->upload) continue;
#endif
}
if (f->state < 5) {
init_file_transfer(f);
+
+ flush_numeric(f->owner);
+ if (f->owner->free_me) {
+ destroy_conn(f->owner);
+ continue;
+ }
#if WANT_UPLOAD
if (f->upload) continue;
#endif
va_end(args);
}
+/* flush_numeric():
+ * Actually flushes the buffer written by numeric() -- but does
+ * NOT erase it. If an error, sets the "free_me" flag in the socket.
+ */
+void flush_numeric(struct conn * const c)
+{
+ if (send(c->sock, message_buf, strlen(message_buf), 0) == -1 && errno == EPIPE)
+ c->free_me = 1;
+}
+
/*
* init_file_transfer():
* Initiate a data connection for sending. This does not open
void remove_bytes(struct conn * const c, const int i);
void numeric(struct conn * const c, const int numeric, const char * const format, ...);
+void flush_numeric(struct conn * const c);
void init_file_transfer(struct ftran * const f);
int create_server_socket();