diff options
author | George Hazan <george.hazan@gmail.com> | 2013-09-10 09:51:26 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-09-10 09:51:26 +0000 |
commit | 978f1a8b1ab79642c7ff4301ca00aff6eb4a2890 (patch) | |
tree | 398df9a4376f37edd22b652426a468d50ba7f8c5 /protocols/JabberG/src/jabber_file.cpp | |
parent | 2e7712a526556ead476ead3083039417f7eba863 (diff) |
obsolete function ThreadData::send(...) removed
git-svn-id: http://svn.miranda-ng.org/main/trunk@6040 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/JabberG/src/jabber_file.cpp')
-rw-r--r-- | protocols/JabberG/src/jabber_file.cpp | 61 |
1 files changed, 25 insertions, 36 deletions
diff --git a/protocols/JabberG/src/jabber_file.cpp b/protocols/JabberG/src/jabber_file.cpp index 62d1fa49ef..d00b2324bc 100644 --- a/protocols/JabberG/src/jabber_file.cpp +++ b/protocols/JabberG/src/jabber_file.cpp @@ -28,21 +28,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void __cdecl CJabberProto::FileReceiveThread(filetransfer *ft)
{
- char* buffer;
- int datalen;
ThreadData info(this, JABBER_SESSION_NORMAL);
Log("Thread started: type=file_receive server='%s' port='%d'", ft->httpHostName, ft->httpPort);
ft->type = FT_OOB;
- if ((buffer=(char*)mir_alloc(JABBER_NETWORK_BUFFER_SIZE)) == NULL) {
- Log("Cannot allocate network buffer, thread ended");
- ProtoBroadcastAck(ft->std.hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ft, 0);
- delete ft;
- return;
- }
-
NETLIBOPENCONNECTION nloc = { 0 };
nloc.cbSize = sizeof(nloc);
nloc.cbSize = sizeof(NETLIBOPENCONNECTION);
@@ -52,42 +43,40 @@ void __cdecl CJabberProto::FileReceiveThread(filetransfer *ft) if (info.s == NULL) {
Log("Connection failed (%d), thread ended", WSAGetLastError());
ProtoBroadcastAck(ft->std.hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ft, 0);
- mir_free(buffer);
- delete ft;
- return;
}
+ else {
+ ft->s = info.s;
- ft->s = info.s;
-
- info.send("GET /%s HTTP/1.1\r\nHost: %s\r\n\r\n", ft->httpPath, ft->httpHostName);
- ft->state = FT_CONNECTING;
-
- Log("Entering file_receive recv loop");
- datalen = 0;
+ char buffer[JABBER_NETWORK_BUFFER_SIZE];
+ int datalen = mir_snprintf(buffer, SIZEOF(buffer), "GET /%s HTTP/1.1\r\nHost: %s\r\n\r\n", ft->httpPath, ft->httpHostName);
+ info.send(buffer, datalen);
+ ft->state = FT_CONNECTING;
- while (ft->state != FT_DONE && ft->state != FT_ERROR) {
- int recvResult, bytesParsed;
+ Log("Entering file_receive recv loop");
- Log("Waiting for data...");
- recvResult = info.recv(buffer+datalen, JABBER_NETWORK_BUFFER_SIZE-datalen);
- if (recvResult <= 0)
- break;
- datalen += recvResult;
+ datalen = 0;
+ while (ft->state != FT_DONE && ft->state != FT_ERROR) {
+ int recvResult, bytesParsed;
- bytesParsed = FileReceiveParse(ft, buffer, datalen);
- if (bytesParsed < datalen)
- memmove(buffer, buffer+bytesParsed, datalen-bytesParsed);
- datalen -= bytesParsed;
- }
+ Log("Waiting for data...");
+ recvResult = info.recv(buffer+datalen, JABBER_NETWORK_BUFFER_SIZE-datalen);
+ if (recvResult <= 0)
+ break;
+ datalen += recvResult;
- ft->s = NULL;
+ bytesParsed = FileReceiveParse(ft, buffer, datalen);
+ if (bytesParsed < datalen)
+ memmove(buffer, buffer+bytesParsed, datalen-bytesParsed);
+ datalen -= bytesParsed;
+ }
- if (ft->state==FT_DONE || (ft->state==FT_RECEIVING && ft->std.currentFileSize < 0))
- ft->complete();
+ ft->s = NULL;
- Log("Thread ended: type=file_receive server='%s'", ft->httpHostName);
+ if (ft->state==FT_DONE || (ft->state==FT_RECEIVING && ft->std.currentFileSize < 0))
+ ft->complete();
- mir_free(buffer);
+ Log("Thread ended: type=file_receive server='%s'", ft->httpHostName);
+ }
delete ft;
}
|