|
@@ -9,11 +9,13 @@
|
|
#include <stdio.h>
|
|
#include <stdio.h>
|
|
#include <unistd.h>
|
|
#include <unistd.h>
|
|
#include <string.h>
|
|
#include <string.h>
|
|
|
|
+#include <errno.h>
|
|
#include "error.h"
|
|
#include "error.h"
|
|
#include "server.h"
|
|
#include "server.h"
|
|
|
|
|
|
/* --- Extern --- */
|
|
/* --- Extern --- */
|
|
extern int serrno;
|
|
extern int serrno;
|
|
|
|
+extern int errno;
|
|
|
|
|
|
/* --- Fonctions privées --- */
|
|
/* --- Fonctions privées --- */
|
|
boolean server_bind_tcp(Server this, int port) {
|
|
boolean server_bind_tcp(Server this, int port) {
|
|
@@ -74,7 +76,12 @@ boolean server_send_tcp(Server this, char* msg) {
|
|
/* Envoi message */
|
|
/* Envoi message */
|
|
tmp = write(this->socket_client, msg, strlen(msg) * sizeof (char));
|
|
tmp = write(this->socket_client, msg, strlen(msg) * sizeof (char));
|
|
if (tmp == ERR) {
|
|
if (tmp == ERR) {
|
|
- serrno = SESEND;
|
|
|
|
|
|
+ //Si connexion coupé (et SIGPIPE)
|
|
|
|
+ if(errno == EPIPE){
|
|
|
|
+ serrno = SEABORT;
|
|
|
|
+ } else {
|
|
|
|
+ serrno = SESEND;
|
|
|
|
+ }
|
|
addperror("Impossible d'envoyer les données");
|
|
addperror("Impossible d'envoyer les données");
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|